package setObj;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

public class ConnTest
{
 public static void main(String[] args)
 {
  try
  {
   dmConn oc=new dmConn();
   Connection conn=oc.dmGetConn();
   Statement  stmt=conn.createStatement();
   
   // CREATE TABLE a(deptno varchar(20),dname  varchar(20),loc  varchar(20))
   
   String sql2="insert into a(deptno,dname,loc) values(?,?,?)";
   String sql21="select * from a where deptno=? and dname=? and loc=?";

   PreparedStatement ps=conn.prepareStatement(sql21);

   ps.setObject(1,null);

   ps.setString(2, "pmo");

   ps.setString(3,"beijing");

   //int rs2=ps.executeUpdate();
   ResultSet rs2=ps.executeQuery();
   while(rs2.next()){
	   System.out.println(rs2.getString(1));
	   System.out.println(rs2.getString(2));
	   System.out.println(rs2.getString(3));

   }
   
  }
  catch(Exception e)
  {
  e.printStackTrace();
 }
 }
}